package com.dartfar.workflow.service;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.hibernate.type.IntegerType;
import org.hibernate.type.StringType;
import org.hibernate.type.Type;
import org.springframework.stereotype.Component;

import com.dartfar.base.dao.DaoUtil;
import com.dartfar.base.service.BaseServiceImpl;
import com.dartfar.workflow.model.WorkflowDeployTask;

@Component("workflowDeployTaskService")
public class WorkflowDeployTaskServiceImpl extends BaseServiceImpl<WorkflowDeployTask> implements WorkflowDeployTaskService {

	static Logger logger = Logger.getLogger(WorkflowDeployTaskServiceImpl.class);
	
	@Resource
	private DaoUtil<WorkflowDeployTask> workflowDeployTaskDaoUtil;
	
	/**
	 * 根据流程部署ID和任务节点名称获取节点委托人对象
	 * @param deployId
	 * @param taskName
	 * @return WorkflowDeployTask
	 */
	@Override
	public List<WorkflowDeployTask> getEntrustManagerByTaskNode(int id,
			String taskName) {
		// TODO Auto-generated method stub
		String hql = "from WorkflowDeployTask w where w.workflowDeployment.id = ? and w.taskName = ?";
		return workflowDeployTaskDaoUtil.getList(hql, new Object[]{id, taskName}, new Type[]{new IntegerType(), new StringType()});
	}
	
	

}
